# -------------------------------------------------------------------
#       -*- coding: utf-8 -*-
#   @Project    :   spider
#   @File       :   42_多进程.py
#   @Author     :   WANGYU
#   @Time       :   2021-08-22 10:18:15
#   @Software   :   PyCharm
#   @Desc       :   
# -------------------------------------------------------------------


from multiprocessing import Process


def func():
    for i in range(1000):
        print('子进程', i)


if __name__ == '__main__':
    p = Process(target=func)
    p.start()

    p2 = Process(target=func)
    p2.start()

    for i in range(1000):
        print('主进程', i)

# 多线程传参
# from threading import Thread
#
#
# def func(name):
#     for i in range(100):
#         print(name, i)
#
#
# if __name__ == '__main__':
#     t1 = Thread(target=func, args=('周杰伦',))  # 传参必须是元祖('周杰伦',)，给func函数传一个元祖('周杰伦',)
#     t1.start()
#
#     t2 = Thread(target=func, args=('王力宏',))
#     t2.start()
